package com.ccc.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Loan entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "loan")
public class Loan implements java.io.Serializable {

	// Fields

	private Integer loanId;
	private User user;
	private Integer currentTime;
	private Integer loan;
	private Integer loanTime;

	// Constructors

	/** default constructor */
	public Loan() {
	}

	/** full constructor */
	public Loan(User user, Integer currentTime, Integer loan, Integer loanTime) {
		this.user = user;
		this.currentTime = currentTime;
		this.loan = loan;
		this.loanTime = loanTime;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "loanId", unique = true, nullable = false)
	public Integer getLoanId() {
		return this.loanId;
	}

	public void setLoanId(Integer loanId) {
		this.loanId = loanId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "currentTime", nullable = false)
	public Integer getCurrentTime() {
		return this.currentTime;
	}

	public void setCurrentTime(Integer currentTime) {
		this.currentTime = currentTime;
	}

	@Column(name = "loan", nullable = false)
	public Integer getLoan() {
		return this.loan;
	}

	public void setLoan(Integer loan) {
		this.loan = loan;
	}

	@Column(name = "loanTime", nullable = false)
	public Integer getLoanTime() {
		return this.loanTime;
	}

	public void setLoanTime(Integer loanTime) {
		this.loanTime = loanTime;
	}

}